#ifndef BACKTESTENGINE_H
#define BACKTESTENGINE_H
#include "strategy.h"


class BacktestEngine {
public:
    BacktestEngine(Strategy* strategy) : m_strategy(strategy) {}
    BacktestEngine() {}
    void setStrategy(Strategy* strategy){m_strategy=strategy;}

    void setData(const QVector<CandleData>& data) { m_data = data; }
    void setInitialBalance(double balance) { m_initialBalance = balance; }

    bool run();

    double getTotalReturn() const { return m_strategy->getTotalReturn(); }
    const QVector<TradeRecord>& getTrades() const { return m_strategy->getTrades(); }
    double getFinalBalance() const { return m_strategy->getFinalBalance(); }

private:

    Strategy* m_strategy;
    QVector<CandleData> m_data;
    double m_initialBalance = 10000.0;
};


#endif // BACKTESTENGINE_H
